/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = frstat_thread_del.c                                */
/*  NOTE      =                                                    */
/*  DATE      = 2016/04/18 by geyh                                 */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"
#include "conntrack.h"
#include "frstat_thread.h"

#include "frstat_module.h"


static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}


static void __case1(void)
{
    int i_ret = 0;
    unsigned long int i_thread_id = 10;
    char *p_result = NULL;

    frstat_thread_init(1);

    frstat_thread_del(i_thread_id);

    CU_ASSERT_EQUAL(i_ret,FR_SUCC);

    frstat_thread_output(&p_result);
    frdbg("\n\toutput:%s",p_result);
    frfree(p_result);
    frstat_thread_destory();
    return;

}

static void __case2(void)
{
    int i_ret = 0;
    unsigned long int i_thread_id = 10;
    int i_task_done = 10;
    int i_error = 10;
    int i_request = 10;
    int i_response = 10;
    char *p_result = NULL;

    frstat_thread_init(1);

    frstat_thread_add(i_thread_id, i_task_done, i_error, i_request, i_response);
    frstat_thread_del(i_thread_id);

    CU_ASSERT_EQUAL(i_ret,FR_SUCC);

    frstat_thread_output(&p_result);
    frdbg("\n\toutput:%s",p_result);
    frfree(p_result);
    frstat_thread_destory();
    return;

}




int add_suite_frstat_thread_del(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite("frstat_thread frstat_thread_del()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    CU_add_test(pSuite, "case1", __case1);
    CU_add_test(pSuite, "case2", __case2);
//    CU_add_test(pSuite, "case3", __case3);
//    CU_add_test(pSuite, "case4", __case4);

    return FR_SUCC;
}
